package processes.printSumProcess;

import os.MiniOS;
import os.MiniProcess;
import os.MiniThread;

public class PrintSumProcessThread extends MiniThread
{

	public PrintSumProcessThread(MiniProcess process, String tid)
	{
		super(process, tid);
		description = "Main Thread";
	}

	@Override
	public void run()
	{
		isExcecutionStopped();
		System.out.println("Inside Run");
		double sum = 0;
		for (int i = 0; i < 100000; i++)
		{
			if (i % 10000 == 0)
			{
				isExcecutionStopped();
			}
			sum += i;
		}
		MiniOS.getInstance().outputRequest(this, "Sum = " + sum);
		isExcecutionStopped();
		MiniOS.getInstance().threadTerminated(process.getPid(), tid);
	}

	@Override
	public void passThreadArguments(Object[] arguments)
	{
	}

}
